package com.wuhunyu.commonutils.check;

import java.util.ArrayList;
import java.util.List;

/**
 * 校验工具类
 *
 * @author wuhunyu
 * @version 1.0
 * @date 2021-01-13 10:58
 */
public class Check {

    /**
     * 判断单独的对象是否为空
     * @param obj
     * @return
     */
    public static boolean isBlank(Object obj) {
        if (obj instanceof Integer) {
            return null == (Integer) obj;
        }
        return null == obj || "".equals(obj.toString().trim());
    }

    /**
     * 判断list集合是否为空
     * @param list
     * @return
     */
    public static boolean isBlank(List<Object> list) {
        return list == null || list.size() == 0;
    }

    /**
     * 判断Integer类型数据正确性
     * @param integer
     * @return
     */
    public static boolean isBlank(Integer integer) {
        return integer == null || integer < 0;
    }

    public static boolean isNotBlank(Object obj) {
        return !isBlank(obj);
    }

    public static boolean isNotBlank(List<Object> list) {
        return !isBlank(list);
    }

    public static boolean isNotBlank(Integer integer) {
        return !isBlank(integer);
    }

}
